import React from 'react'
import {COUNT_MINUS,COUNT_PLUS} from '../redux/action'
import {connect} from 'react-redux'
class Home extends React.Component {

    render(){
        return (
            <div>
                <div className="home">
                    <div onClick={()=>{
                        this.props.plus()
                    }}>+</div>
                    <div className="home_count">{this.props.count}</div>
                    <div onClick={()=>{
                        this.props.minus()
                    }}>-</div>
                </div>
            </div>
        )
    }
}
function mapActionToProps(dispatch){
    return {
        plus:()=>{dispatch(COUNT_PLUS())},
        minus:()=>{dispatch(COUNT_MINUS())}
    }
}

function mapStateToProps(rootReducer){
    return {
        count:rootReducer.countReducer.count
    }
}



export default connect(mapStateToProps,mapActionToProps)(Home)